import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useThirdStore = defineStore('third',
    () => {
        const sessionId = ref<string>()

        const setSessionId = (sessionKey: string) => {
            sessionId.value = sessionKey
        }
        const clearSessionId = () => {
            sessionId.value = undefined
        }
        return {
            sessionId,
            setSessionId,
            clearSessionId
        }
    },
    {
        persist: {
            enabled: true,
            strategies: [
                {
                    key: 'third',
                    storage: localStorage,
                },
            ]
        },
    }
)